import Vue from 'vue'
import App from './App.vue'
import VueRouter from "vue-router";
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import router from "@/router/router";
import axios from "axios";
import login from "@/vuejs/login";

Vue.prototype.GLOBAL = login
Vue.use(ElementUI)
Vue.config.productionTip = false
Vue.use(VueRouter)
Vue.prototype.$axios = axios.create({
  headers: { 'content-type' : 'application/x-www-form-urlencoded'}

});

const originalPush = VueRouter.prototype.push
const originalReplace = VueRouter.prototype.replace
// 重写原型上的push方法，统一处理错误信息
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
VueRouter.prototype.replace= function replace(location) {
  return originalReplace.call(this, location).catch(err => err)
}
axios.defaults.baseURL="/xxyf/"
// axios.defaults.withCredentials=true

// axios.defaults.baseURL="http://localhost:8080/mvc1"
// axios.defaults.baseURL="http://xxyf.fgimaxl2.vipnps.vip/mvc1"
new Vue({
  //用render来创建vue
  render: h => h(App),
  router:router
}).$mount('#app')
